<% layout("/WEB-INF/view/console/skins/skin_2/layout.html", {}) {
%>
<div class="row">
    <div class="col-md-12">
        <div class="widget-container fluid-height clearfix">
            <div class="widget-content padded clearfix">
                <div class='row'>
                    <div class='col-md-12'>
                        <form name="boGoods_form" id="boGoods_form" class='form-inline'>
                            <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='goods_title'  >商品名称</label>
 <input  onkeyup='boGoodsConsoleGrid.enterToQuery(event);' type='text' class='form-control' id='goodsTitle' name='goodsTitle' placeholder=''>
 </div>
 <div class='form-group col-md-3' style='margin-top: 10px;'>
 <label title='商品分类id'  >商品分类：</label>
 <select    class='form-control' id='goodsTypeId' name='goodsTypeId' placeholder=''></select>
 </div>
                            <script>
                                $(function($) {
                                    componentSelectInit(
                                            {
                                                ctxPath:'${ctxPath}',
                                                tableName:"bo_goods_type",
                                                showValueField:"goods_type_name",
                                                valueField:"goods_type_id",
                                                selectId:"goodsTypeId"
                                            }
                                            ,function(){
                                                $("#goodsTypeId").val("${boGoods.goodsTypeId!''}");
                                            });
                                });
                            </script>
                        </form>
                    </div>
                </div>
                <div class='row'>
                    <div align="center">
                        <button type='button' class='btn btn-default' id='boGoodsQuerySearch'>查询</button>
                        <button type='button' class='btn btn-default' id='boGoodsReset'>重置</button>
                    </div>
                </div>
                 <div id="boGoodsToolbar" class="btn-group">
                              <button type="button" class="btn btn-default" onclick="consoleOpenWindow('boGoods','${ctxPath}/console/bo_goods/add','新增')">
                                  <i class="glyphicon glyphicon-plus"></i>
                              </button>
                              <button type="button" class="btn btn-default" onclick='boGoodsConsoleGrid.delete("goodsId","${ctxPath}/console/bo_goods/delete");'>
                                  <i class="glyphicon glyphicon-trash"></i>
                              </button>
                 </div>
                     <div class='row'>
                              <div class='col-md-12'>
                                  <table id="boGoods" data-toggle="table"
                                         data-url="${ctxPath}/console/bo_goods/json"
                                         data-pagination="true"
                                         data-query-params="boGoodsLoadParam"
                                         method="post"
                                         data-side-pagination="server"
                                         data-show-refresh="true"
                                         data-show-toggle="true"
                                         data-pagination-loop="false"
                                         data-show-columns="true"
                                         data-toolbar="#boGoodsToolbar">
                                      <thead>
                                      <tr>
                                           <th data-checkbox="true"></th>
                                            <th data-field='goodsId' data-visible='false'>ID</th>
  <th data-sortable='true' data-field='goodsTitle'>商品名称</th>
  <th data-sortable='true' data-field='goodsPrice'>商品价格</th>
  <th data-sortable='true' data-field='goodsOriginalPrice'>商品原价</th>
  <th data-sortable='true' data-field='goodsInventory'>商品数量</th>
  <th data-sortable='true' data-field='goodsTags'>商品标签</th>
  <th data-field='goodsImage' data-sortable='true' data-formatter='boGoodsgoods_imageFormatter'>商品图片</th>
                                          <th data-field='state' data-sortable='true' data-formatter='boGoodsstateFormatter'>状态</th>
                                          <th data-sortable='true' data-field='sort'>排序</th>
  <th data-field='goodsId' data-formatter='boGoodsTableOperate'>操作</th>
 
                                      </tr>
                                      </thead>
                                  </table>
                              </div>
                     </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
     var boGoodsConsoleGrid =new consoleGrid({table_id:"boGoods"});
     boGoodsConsoleGrid.init();
     function boGoodsTableOperate(value){
         return "<button type='button' class='btn btn-xs btn-default command-edit' onclick='consoleOpenWindow(\"boGoods\",\"${ctxPath}/console/bo_goods/edit?id="+value+"\",\"编辑\")'><span class='glyphicon glyphicon-pencil'></span></button> ";
     }
    function boGoodsLoadParam(params){
        params.query=boGoodsQueryString();

        return params;
    }
     function boGoodsQueryString() {
         var objQuery = new Object();
             objQuery.goodsTitle=$('#goodsTitle').val()==''?null:$('#goodsTitle').val();
             objQuery.goodsTypeId=$('#goodsTypeId').val()==''?null:$('#goodsTypeId').val();
         var queryString = JSON.stringify(objQuery);
         return queryString;
     }

           function boGoodsgoods_imageFormatter(value) 
       { 
         return '<a href="'+value+'" target="_blank" > <img style="height:50px;" src="'+value+'" alt="缩略图"> </a>';
       }
     function boGoodsstateFormatter(value)
     {
         var showValue='';
         switch(value+''){
             case '0':
                 showValue = '不可用';
                 break;
             case '1':
                 showValue = '可用';
                 break;
         }
         if(showValue.indexOf('不')!=-1||showValue.indexOf('否')!=-1||showValue.indexOf('禁')!=-1){
             return '<span class="label label-warning">'+showValue+'</span>';
         }else{
             return '<span class="label label-info">'+showValue+'</span>';
         }
     }

 </script>
<%} %>
 